const app = getApp();
Page({
  data: {
    students: [
      { id: 1, name: '张三', parent: 'parent1' },
      { id: 2, name: '李四', parent: 'parent2' }
    ],
    myStudents: []
  },
  onLoad() {
    // 假设家长用户名已存储在 app.globalData.username
    const username = app.globalData.username || wx.getStorageSync('username');
    const myStudents = this.data.students.filter(s => s.parent === username);
    this.setData({ myStudents });
  }
}); 